package com.bauer.java.spring.customtag;

import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.w3c.dom.Element;

/**
 * @ Author     ：rui.wei
 * @ Date       ：Created in 9:51 2018/6/7
 * @ Description：
 */
public class DemoTagDefinitionParser extends AbstractSingleBeanDefinitionParser {


    @Override
    protected Class<?> getBeanClass(Element element) {
        return DemoTag.class;
    }

    @Override
    protected void doParse(Element element, BeanDefinitionBuilder builder){
        String id = element.getAttribute("id");
        String name = element.getAttribute("name");
        if (id != null) {
            builder.addPropertyValue("id",id);
            builder.addPropertyValue("name",name);
        }
    }
}
